//
//  PKViewController.m
//  WuLi
//
//  Created by Gollum on 16/9/10.
//  Copyright © 2016年 Gollum. All rights reserved.
//

#import "PKViewController.h"
#import "YYAnimationView.h"

@interface PKViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@property (nonatomic,strong)UIActivityIndicatorView *action;
@end

@implementation PKViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSURL *url = [NSURL URLWithString:_detailString];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    [_webView loadRequest:request];
    _webView.scrollView.bounces = NO;
}
- (IBAction)handleBack:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}
- (IBAction)shareButton:(id)sender {
    [self showAnimationView];
}
- (void)showAnimationView
{
    NSArray *imgNameArray = @[@"朋友圈"
                              ,@"微信"
                              ,@"QQ"
                              ,@"QQ空间"
                              ,@"新浪微博"
                              ,@"复制链接"
                              , @"收藏-1"
                              ,@"字体设置"
                              ,@"举报"
                              ,@"夜间模式"
                              ];
    
    NSArray *titleArray = @[@"朋友圈"
                            ,@"微信"
                            ,@"QQ"
                            ,@"QQ空间"
                            ,@"新浪微博"
                            ,@"复制链接",
                            @"收藏-1",
                            @"字体设置",
                            @"举报",
                            @"夜间模式"
                            ];
    YYAnimationView *animationView = [[YYAnimationView alloc] initImageNameArray:imgNameArray withItmeTitleArray:titleArray];
    animationView.lineItmeNumber = 3;
    animationView.itmeSize = CGSizeMake(100, 100);
    animationView.itmeTitleFont = [UIFont systemFontOfSize:15];
    [animationView addButtonItmeToAnimationView];
    [animationView showAnimationView];
    animationView.yyAnimationButtonItmeClick = ^( NSInteger tags){
        NSLog(@"%ld",(long)tags);
    };
}

//界面蒙版
- (void)viewWillAppear:(BOOL)animated{
    
    UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [view setTag:108];
    [view setBackgroundColor:[UIColor lightGrayColor]];
    [view setAlpha:0.9];
    [self.view addSubview:view];
    self.action = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];// 指定进度轮大小
    self.action.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
    [self.action setCenter:view.center];// 指定进度轮中心点
    [self.action setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];// 设置进度轮显示类型
    [view addSubview:self.action];
    [self.action startAnimating];
    
}





- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.action stopAnimating];
    UIView *view = (UIView *)[self.view viewWithTag:108];
    [view removeFromSuperview];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
